import jieba
# file = open('E:\\file_demo.txt',mode='r',encoding='utf-8')
# print(file)
# print(file.read())
# file.close()

# with open('E:\\file_demo.txt',mode='r',encoding='utf-8') as file:
#     print(file)
#     print(file.read())
#     file.close()
#
# with open('E:\\file_demo.txt',mode='a',encoding='utf-8') as file1:
#     file1.write("\nwrite...write...write")
#     file1.writelines(['\na','\nb'])
#     file1.close()

# with open('E:\\file_demo.txt',mode='r',encoding='utf-8') as file2:
#     print(file2)
#     # print(file2.read())
#     # print(file2.readline())
#     print(file2.readlines())
#     file2.close()

with open('E:\\file_demo.txt',mode='r+',encoding='utf-8') as file2:
    print(file2)
    # print(file2.read())
    print(file2.tell())
    # print(file2.readline())
    # print(file2.tell())
    file2.seek(3,0)
    print(file2.tell())
    file2.write("01")  # 在此处进行了替换操作
    # print(file2.read())
    file2.close()